package com.citycloud.ccuap.tc.admin.feignclient;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

import com.citycloud.ccuap.commons.json.JSONData;
import com.citycloud.ccuap.commons.sys.entity.SysUser;

@FeignClient(url = "${security.oauth2.client.address}", value = "OAuth2FCService")
public interface OAuth2FCService {

	@PostMapping(value = "/oauth/token", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
	TokenInfo token(@RequestParam("grant_type") String grantType, @RequestParam("code") String code,
			@RequestParam("client_id") String clientId, @RequestParam("client_secret") String clientSecret, @RequestParam("redirect_uri") String redirectUri);

	@GetMapping(value = "/user/getUserInfo", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
	JSONData<SysUser> getUserInfo(@RequestParam("token") String token);
	
	@GetMapping(value = "/oauth/check_token", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
	CheckTokenInfo checkToken(@RequestParam("token") String token);
	
}
